package payment;

import Decorator.PizzaBase;
import java.util.ArrayList;
import java.util.HashMap;

/**
 *
 * @author shenrunfu
 */
public class Payment {

    private PizzaBase pizzaBase;
    private PizzaDiscountInfo discountInfo;
    private double moneyGot;
    private GSTStrategy gstStrategy;

    public PizzaDiscountInfo getDiscountInfo() {
        return discountInfo;
    }

    public GSTStrategy getGstStrategy() {
        return gstStrategy;
    }

    public PizzaBase getPizzaBase() {
        return pizzaBase;
    }

    public double getMoneyGot() {
        return moneyGot;
    }

    public void setMoneyGot(double moneyGot) {
        this.moneyGot = moneyGot;
    }

    public Payment(double moneyGot) {
        this.moneyGot = moneyGot;
    }

    public Payment() {
    }

    public void setGSTStrategy(GSTStrategy gSTStrategy) {
        this.gstStrategy = gSTStrategy;
    }

    public void setPizzaBase(PizzaBase pizzaBase) {
        this.pizzaBase = pizzaBase;
    }

    public void setDiscount(PizzaDiscountInfo discountInfo) {
        this.discountInfo = discountInfo;
    }

    public double calculatePayment() {
        double dicount=pizzaBase.getTotalPrice()*discountInfo.getDiscount(pizzaBase);
        double gst=gstStrategy.calculateGST(pizzaBase.getTotalPrice()-dicount);
        double price=pizzaBase.getTotalPrice();
        return price-dicount+gst; 
    }

    /**
     * get change in numeric format
     *
     * @return
     */
    public double getChange() {
        return moneyGot - calculatePayment();
    }

    public void getChange_in_notes_coins() {
        ArrayList<Double> money = new ArrayList<Double>();
        money.add((double) 20);
        money.add((double) 10);
        money.add((double) 5);
        money.add((double) 1);
        money.add((double) 0.5);
        money.add((double) 0.2);
        money.add((double) 0.1);

        System.out.print(money.toArray());
//        return null;
    }
}
